<style>
td {
	padding:2px;
}
</style>
<h1><%= @project.name %></h1>
<table>
<tr><td colspan="7"><h2>Open Tickets</h2></td></tr>

	<tr>
		<th></th>
		<th>Title</th>
		<th>Tag's</th>
		<th>State</th>
		<th>Type</th>
		<th>Owner</th>
		<th>Updated @</th>
	</tr>
<% for ticket in @project.open_tickets -%>
	<tr>
		<td>#<%= ticket.id %></td>
		<td><%= truncate(ticket.name, 55, '...') %></td>
		<td><%= ticket.tags.collect{|t| t.name.downcase }.sort{|x,y| x.downcase <=> y.downcase}.join(", ") %></td>
		<td><%= Ticket.states.invert[ticket.status].titleize %></td>
		<td><%= Category.find(ticket.ticket_type).name.titleize %></td>
		<td><%= ticket.owner.login if !ticket.owner.nil? %><%= '---' if ticket.owner.nil? %></td>
		<td><%= ticket.updated_at.strftime("%d-%m-%Y %H:%M") %></td>
	</tr>
<% end -%>
<tr><td colspan="7">&nbsp;</td></tr>
<tr><td colspan="7"><h2>Closed last 7 days <small>(<%= Date.today-7 %> - <%= Date.today %>)</small></h2> </td></tr>
	<tr>
		<th></th>
		<th>Title</th>
		<th>Tag's</th>
		<th>State</th>
		<th>Type</th>
		<th>Owner</th>
		<th>Updated @</th>
	</tr>
<% for ticket in @project.closed_tickets_last_week -%>
	<tr>
		<td>#<%= ticket.id %></td>
		<td><%= truncate(ticket.name, 55, '...') %></td>
		<td><%= ticket.tags.collect{|t| t.name.downcase }.sort{|x,y| x.downcase <=> y.downcase}.join(", ") %></td>
		<td><%= Ticket.states.invert[ticket.status].titleize %></td>
		<td><%= Category.find(ticket.ticket_type).name.titleize %></td>
		<td><%= ticket.owner.login if !ticket.owner.nil? %><%= '---' if ticket.owner.nil? %></td>
		<td><%= ticket.updated_at.strftime("%d-%m-%Y %H:%M") %></td>
	</tr>
<% end -%>
</table>
<br />
<br />
Completed: <%= @project.closed_tickets.length.to_s %><br />
Open: 	<%= @project.open_tickets.length.to_s %><br />
<table id= "progress">
	<tr>
		<td class="closed"style="width:<%= @project.procent_closed.to_s %>%;"></td>
		<td class="open"style="width:<%= (100 - @project.procent_closed).to_s %>%;"></td>
	</tr>
</table>
<%= @project.procent_closed.to_s %>% completed of <%= @project.tickets.count.to_s %><br />		